import { observable } from "mobx";
import { requestGoodList, requestCate } from "../utils/api";

const goodStore = observable({
  goodcate: [],
  goodlist: [],
  goodmapnum: 0,
  getGoodList(data) {
    // console.log(data);
    requestGoodList(data).then((res) => {
      console.log("mobx-------", res);
      this.goodlist = res.data.list;
      this.goodmapnum = Math.floor(res.data.list.length / 2);
      // console.log( this.goodmapnum);
    });
  },
  getGoodCate() {
    requestCate().then((res) => {
      console.log(res);
      this.goodcate = res.data.list;
    });
  },
});

export default goodStore;
